package com.yuyou.fn.tms.vo;

import io.swagger.annotations.ApiModel;

@ApiModel("返回对象")
public class ResponseResult<T> {

    public static <T> ResponseResult<T> success(T data) {
        return new ResponseResult(200, "OK", data);
    }

    public static <T> ResponseResult<T> fail(String error) {
        return new ResponseResult(500, error, null);
    }

    public static <T> ResponseResult<T> fail(String error, T data) {
        return new ResponseResult(500, error, data);
    }

    private int status;

    private String description;

    private T data;

    public ResponseResult(int status, String description, T data) {
        this.status = status;
        this.description = description;
        this.data = data;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
